<?php



namespace App\Http\Requests\ApiV2;

use Illuminate\Support\Facades\Auth;

class PointRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required|max:120',

        ];
    }

    public function messages()
    {
        return [
            'title.required' => __('请输入积分标题'),
            'thumb.required' => __('请输入积分的封面'),
            'point.required' => __('请输入积分数目'),

        ];
    }

    public function filldata()
    {
        $user = Auth::user();
        return [
            'user_id'=>Auth::id(),
            'family_id'=>$user['family_id'],
            'title' =>(string) $this->input('title', ''),
            'thumb' =>(string) $this->input('thumb', ''),
            'point' =>(string) $this->input('point', ''),
            'description' =>(string) $this->input('description', ''),


        ];
    }
}
